<?php 
defined('_JEXEC') or die('Restricted access');

/**
 * Description of DynamicContainer
 *   This is a temporary Dynamic Container Class
 * 
 *  Usage Test:
 *    $a = new DynamicContainer();
 *    $a->test1 = 'value1';
 *    $a->test2 = 'value2';
 *    //unset($a->test1);
 *    echo '<pre>';	
 *    print_r($a);
 *    echo '</pre>';
 *
 *    //Check for test 1
 *    if(isset($a->test1)){echo "<br>test1={$a->test1}<br>";
 *    else echo '<br>test1 not-set';
 * 
 * @author Don't remember...
 *
 */
class dynamicContainer {
    protected $_container = array();

    public function __construct() { 
        
    }

    public function __get($name){
        if(array_key_exists($name,$this->_container)){
            return $this->_container[$name];
        } else { 
            return NULL; 
        }
    }
    
    public function __set($name,$value){
        $this->_container[$name] = $value;
    }

    public function __isset($name){
        return isset($this->_container[$name]);
    }

    public function __unset($name){
        unset($this->_container[$name]);
    }
    
    public function toArray(){
        return (array)$this->_container;
    }
    
    public function __destruct() {
        
    }

}
?>